﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Text;
using TL_Cloud.Models.BookShop;
using TL_Cloud.ViewModels.BookShop.BKInfo;

namespace TL_Cloud.ViewModels.BookShop.BKDownLoadRecord
{
    /// <summary>
    ///图书下载资源的资源
    /// </summary>
    public class BKDownloadResource:BKInfoBasicResource
    {
        public string BookId { get; set; }
       
        public string RecordId { get; set; }

        public string DownloadUserId { get; set; }

        public string DownloadUserName { get; set; }

        public DateTime? CreateDate { get; set; }
    }

    public class BKDownloadMappingProfile:Profile
    {
        public BKDownloadMappingProfile()
        {
            CreateMap<Bk_DownloadRecord, BKDownloadResource>()
                .ForMember(dest => dest.BookName, opt => opt.MapFrom(src => src.bookInfo.BookName))
                .ForMember(dest => dest.BKTypeId, opt => opt.MapFrom(src => src.bookInfo.BKTypeId))
                .ForMember(dest => dest.Author, opt => opt.MapFrom(src => src.bookInfo.Author))
                .ForMember(dest => dest.Pulisher, opt => opt.MapFrom(src => src.bookInfo.Pulisher))
                .ForMember(dest => dest.Isbn, opt => opt.MapFrom(src => src.bookInfo.Isbn))
                .ForMember(dest => dest.ConverUrl, opt => opt.MapFrom(src => src.bookInfo.ConverUrl))
                .ForMember(dest => dest.Introduce, opt => opt.MapFrom(src => src.bookInfo.Introduce))
                .ForMember(dest => dest.Remark, opt => opt.MapFrom(src => src.bookInfo.Remark));
        }
    }
}
